package com.tbit.uqbike.webmanager.req.tag;

import cn.hutool.core.collection.CollectionUtil;
import com.tbit.uqbike.object.business.UserInfo;
import com.tbit.uqbike.webmanager.dto.TagDTO;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 删除标签请求
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/8
 */
@Data
public class DeleteTagReq {

        /**
        * 标签ID列表
        */
        @NotEmpty(message = "标签ID列表不能为空")
        private List<String> ids;



        public List<TagDTO> tagDTOList(UserInfo userInfo){
                if (CollectionUtil.isEmpty(ids)){
                        return Collections.emptyList();
                }
                List<TagDTO> tagDTOList = ids.stream().map(id -> {
                        TagDTO tagDTO = new TagDTO();
                        tagDTO.setId(Long.valueOf(id));
                        tagDTO.setUserInfo(userInfo);
                        return tagDTO;
                }).collect(Collectors.toList());
                return tagDTOList;
        }

}
